import java.util.Vector;

//---------------------------------------------------------------------
//
//---------------------------------------------------------------------

class FuncSTO extends STO
{
	private Type m_returnType;
	private Vector<STO> paramList;
	private boolean hasReturnStmt;
	private boolean isReturnByRef;

	//----------------------------------------------------------------
	//
	//----------------------------------------------------------------
	public FuncSTO(String strName)
	{
		super(strName);
		setType(new FuncPtrType());
		setIsRValue();
	}

	public FuncSTO(String strName, Type returnType)
	{
		super(strName);
		FuncPtrType fpt = new FuncPtrType();
		fpt.setReturnType(returnType);
		setType(fpt);
		setReturnType(returnType);
	}
	
	
	public FuncSTO(String strName, Type returnType, Vector<STO> newParamList)
	{
		super(strName);
		FuncPtrType fpt = new FuncPtrType();
		fpt.setReturnType(returnType);
		fpt.setParamList(newParamList);
		setType(fpt);
		setReturnType(returnType);
		setParamList(newParamList);
	}
	
	public FuncSTO(String strName, Type returnType, boolean isRef)
	{
		super (strName);
		FuncPtrType fpt = new FuncPtrType();
		fpt.setReturnType(returnType);
		fpt.setReturnByRef(isRef);
		setReturnType(returnType);
		setType(fpt);
		setIsRValue();
		setReturnByRef(isRef);
	}
	//----------------------------------------------------------------
	//
	//----------------------------------------------------------------
	public boolean isFunc() 
	{ 
		return true;
	}

	//----------------------------------------------------------------
	// This is the return type of the function. This is different from 
	// the function's type (for function pointers).
	//----------------------------------------------------------------
	public void setReturnType(Type typ)
	{
		m_returnType = typ;
	}

	//----------------------------------------------------------------
	//
	//----------------------------------------------------------------
	public Type getReturnType ()
	{
		return m_returnType;
	}

	protected Vector<STO> getParamList() {
		return paramList;
	}

	
	public void setParamList(Vector<STO> paramList) {
		((FuncPtrType)this.getType()).setParamList(paramList);
		this.paramList = paramList;
	}

	public boolean getHasReturnStmt() {
		return hasReturnStmt;
	}

	public void setHasReturnStmt(boolean hasReturnStmt) {
		((FuncPtrType)this.getType()).setHasReturnStmt(hasReturnStmt);
		this.hasReturnStmt = hasReturnStmt;
	}

	public boolean isReturnByRef() {
		return isReturnByRef;
	}

	public void setReturnByRef(boolean isReturnByRef) {
		((FuncPtrType)this.getType()).setReturnByRef(isReturnByRef);
		this.isReturnByRef = isReturnByRef;
	}
	
}
